import java.net.*;
import java.util.*;

public
class SendSMS
{
	protected String numFrom;
	protected String numTo;
	protected String text;

	public SendSMS(String numFrom, String numTo, String text)
	{
		this.numFrom = numFrom;
		this.numTo = numTo;
		this.text = text;
	}
	public void send()
	throws Exception
	{
		String pref = numTo.substring(0, 3);
		if (pref.equals("501") || pref.equals("502") || 
			pref.equals("503") || pref.equals("504")){
			sendIdea();
		}
		else if (pref.equals("600") || pref.equals("602") ||
			pref.equals("604") || pref.equals("606") ||
			pref.equals("608") || pref.equals("692")){
			sendEra();
		}
		else if (pref.equals("601") || pref.equals("603") ||
			pref.equals("605") || pref.equals("607") ||
			pref.equals("609") || pref.equals("691")){
			sendPlus();
		}
		else{
			throw new Exception("Unsupported phone number.");
		}
	}
	protected void sendIdea()
	throws Exception
	{
		SMSIdea smsIdea = new SMSIdea(numFrom, numTo, text);
		smsIdea.send();
	}
	protected void sendEra()
	throws Exception
	{
		SMSEra smsEra = new SMSEra(numFrom, numTo, text);
		smsEra.send();
	}
	protected void sendPlus()
	throws Exception
	{
		SMSPlus smsPlus = new SMSPlus(numFrom, numTo, text);
		smsPlus.send();
	}
}
